Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Warning Check to Evaluate Total Field amount in Structs #1180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mgmilton
Copy link

This PR introduces a new Warning Check that evaluates structs to check to see if they contain a reasonable number of fields. Structs are stored as flat maps if they have fewer than 32 fields. However, the Erlang VM stores structs with greater than 32 fields as hash maps. This can potentially lead to bloating and higher memory usage.

Structs with more than 32 fields are considered an anti-pattern in the official Elixir documentation.

@mgmilton mgmilton force-pushed the add-struct-field-checker branch from c1c6c33 to a59bd22 Compare February 21, 2025 16:28
@rrrene
Copy link
Owner

rrrene commented Feb 22, 2025

Hi, I like the idea behind this check.

Will try to review as soon as I can 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants